#!/usr/bin/python
import sys
import traceback

from osm_utils import CountryMap
import experiment_runner


def heavyPart():
    road_map = CountryMap()
#     road_map.LoadMap()
#     road_map.MapStat()
#     import problem_generator as pg
#     pg.GenerateProblemSet(road_map)
#     pg.SaveToFile('ProblemSet100.csv',  pg.GenerateProblemSet(road_map))

    return road_map


def lightPart(road_map):
    reload(experiment_runner)
    experiment_runner.RunExperiment1(road_map)
    #main.main(road_map)


def run():
    heavyPartCache = heavyPart()
    while True:
        try:
            lightPart(heavyPartCache)
        except Exception as e:
            print e
            traceback.print_exc()
        print "Press ENTER to re-run the script, CTRL-C to exit"
        sys.stdin.readline()


if __name__ == "__main__":
    run()
